home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / dmake38c.zip / VFPRINTF.C < prev   
C/C++ Source or Header  |  1992-01-23  |  934b  |  59 lines

  1. /* From:
  2.  * John Limpert            johnl@gronk.UUCP        uunet!n3dmc!gronk!johnl
  3.  */
  4.  
  5. #include <stdio.h>
  6. #include <varargs.h>
  7.  
  8. #ifndef BUFSIZ
  9. #include <stdio.h>
  10. #endif
  11.  
  12. #ifndef va_dcl
  13. #include <varargs.h>
  14. #endif
  15.  
  16. int
  17. vsprintf(str, fmt, ap)
  18.     char *str, *fmt;
  19.     va_list ap;
  20. {
  21.     FILE f;
  22.     int len;
  23.  
  24.     f._flag = _IOWRT+_IOMYBUF;
  25.     f._ptr = (char *)str;    /* My copy of BSD stdio.h has this as (char *)
  26.                  * with a comment that it should be
  27.                  * (unsigned char *).  Since this code is
  28.                  * intended for use on a vanilla BSD system,
  29.                  * we'll stick with (char *) for now.
  30.                  */
  31.     f._cnt = 32767;
  32.     len = _doprnt(fmt, ap, &f);
  33.     *f._ptr = 0;
  34.     return (len);
  35. }
  36.  
  37. int
  38. vfprintf(iop, fmt, ap)
  39.     FILE *iop;
  40.     char *fmt;
  41.     va_list ap;
  42. {
  43.     int len;
  44.  
  45.     len = _doprnt(fmt, ap, iop);
  46.     return (ferror(iop) ? EOF : len);
  47. }
  48.  
  49. int
  50. vprintf(fmt, ap)
  51.     char *fmt;
  52.     va_list ap;
  53. {
  54.     int len;
  55.  
  56.     len = _doprnt(fmt, ap, stdout);
  57.     return (ferror(stdout) ? EOF : len);
  58. }
  59.